<template>
  <div class="main">
    <van-nav-bar title="自动化工具">
      <template #right>
        <span class="c-blue" @click="exit()">退出<van-icon name="cross"/></span>
      </template>
    </van-nav-bar>

    <div class="flex flex-col">
      <div class="flex-1">
        <van-tabs v-model:active="activeIndex">
          <van-tab title="测试">
            <TEST></TEST>
          </van-tab>
          <van-tab title="签到">
            <XFTSign></XFTSign>
          </van-tab>
          <van-tab title="红果短剧">
            
          </van-tab>
        </van-tabs>
      </div>
      <div class="px-3">
        <van-button class="mt-2 w-full" type="primary" @click="runScript()">开始运行</van-button>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue';
import XFTSign from './views/XFTSign.vue';
import TEST from './views/TEST.vue';

const activeIndex = ref(0);

function runScript() {
  window.airscript?.close();
  window.airscript?.call('run', `${activeIndex.value}`);
}

function exit() {
  window.airscript?.call('exit', '')
}
</script>

<style lang="scss" scoped>
.main {

}
</style>
